<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:p="http://primefaces.org/ui">

<ui:composition template="/layout/mobileLayout.xhtml">
	<ui:define name="contentPart">
		<h:form id="formId" style="font-size:40px">
			<div id="detailsDiv">
				<h:outputText value="Details: #{shoppingListsAction.selectedShoppingList.list.creationDate}"/>
				<p:dataTable value="#{shoppingListsAction.selectedShoppingList.list.items}" var="item">
					<p:column headerText="Name" style="text-align:center;" width="600">
						#{item.name}
					</p:column>

					<p:column headerText="Quantity" style="text-align:center;" width="200">
						#{item.quantity}
					</p:column>

					<p:column style="text-align:center">
						<p:commandButton action="#{shoppingListsAction.tickItem}" update=":formId" icon="#{item.ticked ? 'buttonChecked32' : 'buttonUnchecked32' }">
							<f:setPropertyActionListener value="#{item}" target="#{shoppingListsAction.selectedItem}"/>
						</p:commandButton>
					</p:column>
				</p:dataTable>
			</div>

		</h:form>
	</ui:define>
</ui:composition>
</html>
